from django.urls import path
from django.conf.urls.static import static
from django.conf import settings
from web.Apis import user, activity, reward, participation, system, financial


from web.views import index

urlpatterns = [
    path('web/ht/template/', index.template, name='template'),
    path('web/ht/index/', index.index, name='index'),
    path('', index.index, name='index'),
    path('web/ht/activity/', index.activity, name='activity'),
    path('web/ht/activity/participate/', index.participate, name='participate'),
    path('web/ht/activity/approve/', index.approve, name='approve'),
    path('web/ht/version/', index.version, name='version'),
    path('web/ht/login/', index.login, name='login'),
    path('web/ht/financial/', index.financial, name='financial'),
    # 用户相关
    path('api/user/register/', user.register, name='user_register'), # 用户注册
    path('api/user/login/', user.login, name='user_login'), # 用户登录
    path('api/user/list/', user.get_user_list, name='user_list'), # 获取用户列表
    path('api/user/edit/', user.edit_user, name='edit_user'), # 编辑用户信息
    path('api/user/delete/', user.delete_user, name='delete_user'), # 注销用户
    path('api/user/is_admin/', user.is_admin, name='is_admin'), # 验证用户是否是管理员
    # 联系方式相关
    path('api/contact/create/', user.create_contact, name='create_contact'), # 创建联系方式
    path('api/contact/get/', user.get_contact, name='get_contact'), # 获取联系方式
    # 活动相关
    path('api/activity/create/', activity.create_activity, name='create_activity'), # 创建活动
    path('api/activity/list/', activity.activity_list, name='activity_list'), # 活动列表
    path('api/activity/detail/', activity.activity_detail, name='activity_detail'), # 活动详情
    path('api/activity/is_participated/', activity.is_participated, name='is_participated'), # 判断用户是否参与活动
    path('api/activity/search/', activity.search_activity, name='search_activity'), # 搜索活动
    path('api/activity/edit/', activity.edit_activity, name='edit_activity'), # 编辑活动
    # 奖励相关
    path('api/reward/create/', reward.create_reward, name='create_reward'), # 创建奖励
    path('api/reward/list/<int:activity_id>/', reward.reward_list, name='reward_list'), # 奖励列表
    path('api/reward/my/', reward.my_rewards, name='my_rewards'), # 我的奖励
    path('api/reward/edit/', reward.edit_reward, name='edit_reward'), # 编辑或删除奖励
    # 参与记录相关
    path('api/participate/', participation.participate, name='participate'), # 参与活动
    path('api/complete/', participation.complete_activity, name='complete_activity'), # 完成活动
    path('api/participation/list/', participation.participation_list, name='participation_list'), # 参与记录列表
    path('api/participation/is_participated_and_ended/', participation.is_participated_and_ended, name='is_participated_and_ended'), # 判断是否参与并且已经结束了活动
    path('api/participation/approve/', participation.approve_activity, name='approve_activity'), # 审批活动
    path('api/participation/statistics/', participation.participation_statistics, name='participation_statistics'), # 参与情况统计
    path('api/participation/approval/list/', participation.get_approval_list, name='get_approval_list'),
    # 系统相关
    path('api/system/version/', system.VersionList, name='version_list'), # 版本列表
    path('api/system/version/create/', system.Versions, name='versions'), # 创建版本
    path('api/system/version/desc/', system.VersionD, name='version_desc'), # 创建版本说明
    path('api/system/version/current/', system.CurrentVersion, name='current_version'), # 当前版本
    path('api/system/csrf/', system.get_csrf_token_view, name='get_csrf_token_view'), # 获取csrf token
    # 财务相关
    path('api/financial/create/', financial.create_financial_flow, name='create_financial_flow'), # 创建财务流水
    path('api/financial/list/', financial.get_financial_flow, name='get_financial_flow'), # 获取财务流水
] 

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
